import test from "node:test";
import path from "path";
import { createRouter, createWebHashHistory, createWebHistory } from "vue-router";

const routes = [
    {
        path: '/',
        name: "home",
        meta: { title: "首页", icon: "HomeFilled" },
        component: () => import("@/views/Home.vue")
    },
    {
        path: '/category',
        name: "category",
        meta: { title: "分类管理", icon: "Menu", roles: ['ROLE_PRODUCT', 'ROLE_ADMIN'] },
        children: [
            {
                path: '/category/add',
                name: "category.add",
                meta: { title: "添加分类", icon: "CirclePlusFilled" },
                component: () => import("@/views/category/Add.vue")
            },
            {
                path: '/category/edit',
                name: "category.edit",
                meta: { title: "编辑分类", icon: "Edit", isShow: false },
                component: () => import("@/views/category/Edit.vue")
            },
            {
                path: '/category/list',
                name: "category.list",
                meta: { title: "分类列表", icon: "Document" },
                component: () => import("@/views/category/List.vue")
            }
        ]
    },
    {
        path: '/product',
        name: "product",
        meta: { title: "商品管理", icon: "HomeFilled", roles: ['ROLE_PRODUCT', 'ROLE_ADMIN'] },
        children: [
            {
                path: '/product/add',
                name: "product.add",
                meta: { title: "添加商品", icon: "CirclePlusFilled" },
                component: () => import("@/views/product/Add.vue")
            },
            {
                path: '/product/edit',
                name: "product.edit",
                meta: { title: "编辑商品", icon: "Edit", isShow: false },
                component: () => import("@/views/product/Edit.vue")
            },
            {
                path: '/product/list',
                name: "product.list",
                meta: { title: "商品列表", icon: "Document" },
                component: () => import("@/views/product/List.vue")
            }
        ]
    },
    {
        path: '/user',
        name: "user",
        meta: { title: "用户管理", icon: "HomeFilled" },
        children: [
            {
                path: '/user/register',
                name: "user.register",
                meta: { title: "用户注册", icon: "CirclePlusFilled", isUseFrame: false },
                component: () => import("@/views/user/Register.vue")
            },
            {
                path: '/user/login',
                name: "user.login",
                meta: { title: "用户登录", icon: "CirclePlusFilled", isUseFrame: false },
                component: () => import("@/views/user/Login.vue")
            },
            {
                path: '/user/list',
                name: "user.list",
                meta: { title: "用户列表", icon: "CirclePlusFilled" },
                component: () => import("@/views/user/List.vue")
            },
            {
                path: '/user/edit',
                name: "user.edit",
                meta: { title: "编辑用户", icon: "Edit", isShow: false },
                component: () => import("@/views/user/Edit.vue")
            },
            {
                path: '/user/test',
                name: "user.test",
                meta: { title: "test", icon: "Document" },
                component: () => import("@/views/user/Test.vue")
            }
        ]
    },
    {
        path: '/warehouse',
        name: "warehouse",
        meta: { title: "仓库管理", icon: "HomeFilled", roles: ['ROLE_STORE', 'ROLE_ADMIN'] },
        children: [
            {
                path: '/warehouse/list',
                name: "warehouse.list",
                meta: { title: "货架管理", icon: "CirclePlusFilled" },
                component: () => import("@/views/warehouse/List.vue")
            },
            {
                path: '/warehouse/add',
                name: "warehouse.add",
                meta: { title: "添加仓库", icon: "CirclePlusFilled" },
                component: () => import("@/views/warehouse/Add.vue")
            },
            {
                path: '/warehouse/edit',
                name: "warehouse.edit",
                meta: { title: "编辑仓库", icon: "Edit", isShow: false },
                component: () => import("@/views/warehouse/Edit.vue")
            },
            {
                path: '/warehouse/houseList',
                name: "warehouse.houseList",
                meta: { title: "仓库列表", icon: "Edit" },
                component: () => import("@/views/warehouse/HouseList.vue")
            }
        ]
    },
    {
        path: '/roles',
        name: "roles",
        meta: { title: "角色管理", icon: "HomeFilled", roles: ['ROLE_ADMIN'] },
        children: [
            {
                path: '/roles/list',
                name: "roles.list",
                meta: { title: "角色列表", icon: "CirclePlusFilled" },
                component: () => import("@/views/roles/List.vue")
            },
            {
                path: '/roles/add',
                name: "roles.add",
                meta: { title: "添加角色", icon: "CirclePlusFilled" },
                component: () => import("@/views/roles/Add.vue")
            },
            {
                path: '/roles/edit',
                name: "roles.edit",
                meta: { title: "编辑角色单", icon: "Edit", isShow: false },
                component: () => import("@/views/roles/Edit.vue")
            },

        ]
    },
    {
        path: '/permissions',
        name: "permissions",
        meta: { title: "权限管理", icon: "HomeFilled", roles: ['ROLE_ADMIN'] },
        children: [
            {
                path: '/permissions/list',
                name: "permissions.list",
                meta: { title: "权限列表", icon: "CirclePlusFilled" },
                component: () => import("@/views/permissions/List.vue")
            },
            {
                path: '/permissions/add',
                name: "permissions.add",
                meta: { title: "权限角色", icon: "CirclePlusFilled" },
                component: () => import("@/views/permissions/Add.vue")
            },
            {
                path: '/permissions/edit',
                name: "permissions.edit",
                meta: { title: "编辑权限", icon: "Edit", isShow: false },
                component: () => import("@/views/permissions/Edit.vue")
            },

        ]
    },
    {
        path: '/vendor',
        name: "vendor",
        meta: { title: "供应商管理", icon: "HomeFilled", roles: ['ROLE_PURCHASE', 'ROLE_PURCHASE_MANAGER', 'ROLE_ADMIN'] },
        children: [
            {
                path: '/vendor/list',
                name: "vendor.list",
                meta: { title: "供应商列表", icon: "Document" },
                component: () => import("@/views/vendor/List.vue")
            },
            {
                path: '/vendor/add',
                name: "vendor.add",
                meta: { title: "添加供应商", icon: "CirclePlusFilled" },
                component: () => import("@/views/vendor/Add.vue")
            },
            {
                path: '/vendor/edit',
                name: "vendor.edit",
                meta: { title: "编辑供应商", icon: "Edit", isShow: false },
                component: () => import("@/views/vendor/Edit.vue")
            }
        ]
    },
    {
        path: '/po',
        name: "po",
        meta: { title: "采购管理", icon: "HomeFilled", roles: ['ROLE_PURCHASE', 'ROLE_PURCHASE_MANAGER', 'ROLE_ADMIN'] },
        children: [
            {
                path: '/po/list',
                name: "po.list",
                meta: { title: "采购列表", icon: "Document" },
                component: () => import("@/views/po/List.vue")
            },
            {
                path: '/po/add',
                name: "po.add",
                meta: { title: "添加采购单", icon: "CirclePlusFilled" },
                component: () => import("@/views/po/Add.vue")
            },
            {
                path: '/po/edit',
                name: "po.edit",
                meta: { title: "编辑采购单", icon: "Edit", isShow: false },
                component: () => import("@/views/po/Edit.vue")
            }
        ]
    }
    ,
    {
        path: '/order',
        name: "order",
        meta: { title: "订单管理", icon: "HomeFilled", roles: ['ROLE_PURCHASE', 'ROLE_PURCHASE_MANAGER', 'ROLE_ADMIN'] },
        children: [
            {
                path: '/order/list',
                name: "order.list",
                meta: { title: "订单列表", icon: "Document" },
                component: () => import("@/views/order/List.vue")
            },
            {
                path: '/order/add',
                name: "order.add",
                meta: { title: "添加订单", icon: "CirclePlusFilled" },
                component: () => import("@/views/order/Add.vue")
            },
            // {
            //     path: '/order/edit',
            //     name: "order.edit",
            //     meta: { title: "编辑订单", icon: "Edit", isShow: false },
            //     component: () => import("@/views/order/Edit.vue")
            // }
        ]
    },
    {
        path: '/io',
        name: "io",
        meta: { title: "入库管理", icon: "HomeFilled", roles: ['ROLE_PURCHASE', 'ROLE_PURCHASE_MANAGER', 'ROLE_ADMIN'] },
        children: [
            {
                path: '/io/list',
                name: "io.list",
                meta: { title: "入库单列表", icon: "Document" },
                component: () => import("@/views/io/List.vue")
            }
            
        ]
    }
    ,
    {
        path: '/oo',
        name: "oo",
        meta: { title: "出库管理", icon: "HomeFilled", roles: ['ROLE_PURCHASE', 'ROLE_PURCHASE_MANAGER', 'ROLE_ADMIN'] },
        children: [
            {
                path: '/oo/list',
                name: "oo.list",
                meta: { title: "出库单列表", icon: "Document" },
                component: () => import("@/views/oo/List.vue")
            },
            // {
            //     path: '/oo/edit',
            //     name: "oo.edit",
            //     meta: { title: "编辑出库", icon: "Document" },
            //     component: () => import("@/views/oo/Edit.vue")
            // },
            {
                path: '/oo/add',
                name: "oo.add",
                meta: { title: "添加出库单", icon: "CirclePlusFilled" },
                component: () => import("@/views/oo/Add.vue")
            }
        ]
    },
    {
        path: '/inventory',
        name: "inventory",
        meta: { title: "库存管理", icon: "HomeFilled", roles: ['ROLE_PURCHASE', 'ROLE_PURCHASE_MANAGER', 'ROLE_ADMIN'] },
        children: [
            {
                path: '/inventory/list',
                name: "inventory.list",
                meta: { title: "库存列表", icon: "Document" },
                component: () => import("@/views/inventory/List.vue")
            }
        ]
    }
]

const router = createRouter({
    // history: createWebHashHistory('/'),
    history: createWebHistory(),
    routes
})

export default router